/*
 * layout.css
 * 作用：定义网站的主要布局样式、组件样式（如按钮、表单、卡片），以及管理员后台和订单页面的特定样式。
 */
/* 整体容器 */
.main-container {
    display: flex;
    max-width: 1400px;
    margin: 20px auto;
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    min-height: calc(100vh - 40px);
}

/* 侧边栏 */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background-color: #f8f9fa;
    border-right: 1px solid var(--border-color);
    padding: 20px;
}

.sidebar-header h3 {
    margin-top: 0;
    color: var(--primary-color);
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 15px;
}

.sidebar-nav a {
    display: block;
    padding: 12px 15px;
    margin-bottom: 8px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: background-color 0.3s, color 0.3s;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* 主内容区 */
.content-area {
    flex-grow: 1;
    padding: 30px;
}

/* 主头部 */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.main-header h1 {
    margin: 0;
    font-size: 1.8rem;
    color: #333;
}

.header-user-actions {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-right: -10px;
}

.header-user-actions .header-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ddd;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.header-user-actions a {
    color: var(--primary-color);
    text-decoration: none;
    margin-left: 0;
    line-height: 1;
}
.header-user-actions span {
    margin-left: 0;
    line-height: 1;
}

/* 商品网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3列布局 */
    gap: 25px;
    margin-bottom: 30px;
}

.product-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: box-shadow 0.3s, transform 0.3s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: var(--box-shadow);
    transform: translateY(-5px);
}

.product-image {
    width: 100%;
    height: 200px; /* 固定高度 */
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保证图片不变形 */
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 15px;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-name {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: #333;
}

.product-price {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.product-actions {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.product-actions .btn-detail, .product-actions .btn-buy {
    flex: 1;
    padding: 8px 10px;
    text-decoration: none;
    border-radius: var(--border-radius);
    text-align: center;
    transition: background-color 0.3s;
}

.product-actions .btn-detail {
    background-color: #f0f0f0;
    color: #333;
}

.product-actions .btn-detail:hover {
    background-color: #e0e0e0;
}

.product-actions .btn-buy {
    background-color: var(--primary-color);
    color: #fff;
}
.product-actions .btn-buy:hover {
    background-color: var(--primary-hover-color);
}


/* 分页 */
.pagination {
    text-align: center;
    margin-top: 30px;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 8px 15px;
    margin: 0 5px;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-color);
}

.pagination a {
    border: 1px solid var(--border-color);
    transition: background-color 0.3s, color 0.3s;
}

.pagination a:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.pagination span {
    font-weight: bold;
    color: var(--primary-color);
}

/* 空状态消息 */
.empty-message {
    grid-column: 1 / -1; /* 占据所有列 */
    text-align: center;
    padding: 50px;
    font-size: 1.2rem;
    color: #999;
}

/* 商品详情页 */
.product-detail-container {
    display: flex;
    gap: 40px;
}

.product-detail-image {
    flex: 1;
    max-width: 500px;
}

.product-detail-image img {
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.product-detail-info {
    flex: 1;
}

.product-detail-info h1 {
    margin-top: 0;
    font-size: 2rem;
    color: #333;
}

.detail-price {
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: bold;
    margin: 20px 0;
}

.detail-price span {
    vertical-align: middle;
}

.detail-description, .detail-seller {
    margin-bottom: 25px;
}

.detail-description h4, .detail-seller h4 {
    margin-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
    display: inline-block;
}

.detail-actions .btn {
    width: auto;
    padding: 15px 40px;
    font-size: 1.2rem;
}

/* 通用页面标题 */
.page-title {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 25px;
}
.page-title h2 {
    margin: 0;
    font-size: 1.6rem;
}

/* 消息提示框 */
.success-message {
    background-color: #e8f5e9;
    color: #4caf50;
    border: 1px solid #c8e6c9;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

/* 用户中心 */
.profile-section {
    background: #fdfdfd;
    border: 1px solid #f0f0f0;
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.profile-section h3 {
    margin-top: 0;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    display: inline-block;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    max-width: 400px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-sizing: border-box;
}

.avatar-group .current-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    display: block;
}

.address-list {
    margin-bottom: 20px;
}

.address-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

.address-item p {
    margin: 0;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
    padding: 5px 15px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-size: 14px;
}
.btn-danger:hover {
    background-color: #c0392b;
}

.add-address-form {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

/* 我的商品页面 - 商品列表 */
.product-list-user {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.product-card-user {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    text-align: center;
}

.product-image-user img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.product-info-user {
    padding: 15px;
}

.product-info-user h4 {
    margin: 0 0 10px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-info-user .price {
    color: var(--primary-color);
    font-weight: bold;
    margin: 0 0 15px 0;
}

.product-info-user .btn-detail {
    display: block;
    background: #f0f0f0;
    padding: 8px;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: #333;
    transition: background-color .3s;
}

.product-info-user .btn-detail:hover {
    background-color: #e0e0e0;
}

.status-active { color: #27ae60; font-weight: bold; }
.status-banned { color: #e74c3c; font-weight: bold; }
.status-other { color: #7f8c8d; font-weight: bold; }

.status-pending { color: #f39c12; font-weight: bold; }
.status-completed { color: #2ecc71; font-weight: bold; }
.status-cancelled { color: #95a5a6; font-weight: bold; text-decoration: line-through;}

/* 管理员表格 */
.admin-table-container {
    background: #fff;
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th, .admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.admin-table tbody tr:nth-of-type(even) {
    background-color: #fdfdfd;
}

.admin-table tbody tr:hover {
    background-color: #f1f1f1;
}

.admin-table td a {
    text-decoration: none;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    color: white;
    margin-right: 5px;
    font-size: 14px;
}

.btn-warning {
    background-color: #f39c12;
}
.btn-warning:hover {
    background-color: #e67e22;
}

.btn-success {
    background-color: #2ecc71;
}
.btn-success:hover {
    background-color: #27ae60;
}

/* 订单页面 - Tab切换 */
.tab-container {
    background: #fff;
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.tab-nav {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-color);
    position: relative;
    top: 2px; /* To align with the bottom border */
    border-bottom: 2px solid transparent;
    transition: color 0.3s, border-color 0.3s;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none; /* Hide inactive tabs */
}

.tab-content.active {
    display: block; /* Show active tab */
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


/* 订单卡片 */
.order-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    background: #fdfdfd;
}

.order-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.order-details {
    flex-grow: 1;
}

.order-details h4 {
    margin: 0 0 10px 0;
}

.order-details p {
    margin: 4px 0;
    font-size: 0.9rem;
    color: #666;
}

.order-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-actions .btn, .order-actions .btn-danger, .order-actions .btn-detail {
    padding: 8px 16px;
    text-align: center;
    text-decoration: none;
    border-radius: var(--border-radius);
    color: white;
}

/* 搜索条样式 */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.search-bar input[type="text"] {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.search-bar input[type="text"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

.search-bar .btn-search {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.search-bar .btn-search:hover {
    background-color: var(--primary-hover-color);
}

/* 消息发布表单样式 */
.message-section {
    background-color: #f8f8f8;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-top: 30px;
    box-shadow: var(--box-shadow-sm);
}

.message-section h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border-color);
}

.message-form .form-group {
    margin-bottom: 15px;
}

.message-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: 'Open Sans', sans-serif;
    resize: vertical;
    min-height: 100px;
    box-sizing: border-box; /* Ensures padding doesn't increase width */
}

.message-form textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

.message-form .btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-decoration: none;
}

.message-form .btn:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-2px);
}

/* 消息列表和消息卡片样式 */
.message-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-sm);
    padding: 20px;
    margin-bottom: 20px; /* Added for consistency with order-card */
    display: flex; /* Use Flexbox */
    flex-direction: column; /* Vertical arrangement */
    gap: 10px; /* Spacing between inner elements */
    transition: box-shadow 0.3s, transform 0.3s;
}

.message-card:hover {
    box-shadow: var(--box-shadow);
    transform: translateY(-2px);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #666;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.message-header span a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

.message-header span a:hover {
    text-decoration: underline;
}

.message-body {
    font-size: 1rem;
    color: #333;
    line-height: 1.6;
}

.message-body p {
    margin-bottom: 5px;
}

.message-product {
    font-size: 0.9rem;
    color: #555;
    margin-top: 10px;
    padding-top: 5px;
    border-top: 1px dashed #eee;
}

.message-product a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

.message-product a:hover {
    text-decoration: underline;
}

.message-actions {
    text-align: right;
    margin-top: 10px;
}

.message-actions .btn.btn-small {
    display: inline-block !important;
    background-color: var(--primary-color) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--border-radius) !important;
    padding: 6px 16px !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    margin-left: 8px;
    margin-top: 4px;
    transition: background-color 0.3s;
}

.message-actions .btn.btn-small:hover {
    background-color: var(--primary-hover-color) !important;
    color: #fff !important;
}

/* 信息提示消息样式 */
.info-message {
    text-align: center;
    padding: 30px;
    font-size: 1.1rem;
    color: #777;
    background-color: #f8f8f8;
    border: 1px dashed #ddd;
    border-radius: var(--border-radius);
    margin-top: 20px;
}

.info-message a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

.info-message a:hover {
    text-decoration: underline;
}

/* 用户编辑商品页面样式 */
.current-product-image {
    max-width: 200px;
    height: auto;
    display: block;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.form-actions {
    display: flex;
    gap: 15px; /* Spacing between buttons */
    margin-top: 20px;
    justify-content: flex-start;
}

.form-actions .btn {
    flex-grow: 0;
    width: auto; /* Buttons width adapts to content */
}

#replySubmitButton {
    display: block !important;
    width: 250px !important; /* 强制宽度 */
    height: 60px !important; /* 强制高度 */
    background-color: red !important; /* 强制红色背景 */
    color: white !important; /* 强制白色文字 */
    font-size: 1.5rem !important;
    border: 3px solid yellow !important; /* 强制黄色边框 */
    margin: 20px auto !important; /* 居中显示，与周围有间距 */
    padding: 10px !important;
    box-sizing: border-box !important;
} 